#pragma once
#include <time.h> //srand
#include <stdio.h> //printf
#include <windows.h>
#include <iostream>
using namespace std;

#include "Map.h"
#include "cli.h"

#define AWARD_START		0
#define AWARD_NOT_OKAY	1
#define AWARD_OKAY		2

#define FALLRATE_MAX		500
#define FALLRATE_MIN		100
#define FALLRATE_RATE		25
#define FALLRATE_INTERVAL	30

class Game
{
private:
	Map base;
	Map piece;
	Map nextPiece;
	int startX, startY, nextX, nextY;
	int pieceColor, nextColor;
	int maxPieceHeight, maxPieceWidth;
	char m_input;
	bool m_playerWantsToQuit, m_gameOver;
	int m_fallTimer, m_age, m_fallRate;
	int m_score;
	bool m_awardOK;
public:
	Game();
	void draw();
	void clearNextPieceArea();
	void handleInput(char a_input);
	void load();
	void release();
	void randomPieceGenerator();
	void setPiece();
	void update(int a_ms);
	bool doesPlayerWantToQuit();
	void writeText();
	void eraseRows();
	bool isGameOver();
	bool getGameOver();
	void printGameOver();
	int selectMap();
	void calcFallRate();
	int getFallRate();
};